/** Theme variables */

// Source: https://material.io/design/color/dark-theme.html

$body-bg-dark: $gray-900;
$body-overlay-dark: darken($body-bg-dark, 2.5%);

/*
$border-dark: darken($body-bg-dark, 2.5%);
*/
$border-dark: $gray-800;
$body-color-dark: $gray-300;
$dots-dark: darken($body-color-dark, 50%);

$link-color-dark: $blue-300;
$button-color-dark: $link-color-dark;
$focus-color-dark: lighten($link-color-dark, 2.5%);

$navbar-dark-color:                 $body-color-dark;
$navbar-dark-hover-color:           $link-color-dark;
$navbar-dark-active-color:          $link-color-dark;

/** Theme styles */

[data-dark-mode] body {
  background: $body-bg-dark;
  color: $body-color-dark;
}

[data-dark-mode] body a {
  color: $link-color-dark;
}

[data-dark-mode] body a.text-body {
  color: $body-color-dark !important;
}

[data-dark-mode] body .btn-primary {
  @include button-variant($button-color-dark, $button-color-dark);

  color: $body-bg-dark !important;
}

[data-dark-mode] body .btn-outline-primary {
  @include button-outline-variant($button-color-dark, $button-color-dark);

  color: $link-color-dark;
}

[data-dark-mode] body .btn-outline-primary:hover {
  color: $body-bg-dark;
}

[data-dark-mode] body .btn-doks-light {
  color: $navbar-dark-color;
}

[data-dark-mode] body .show > .btn-doks-light,
[data-dark-mode] body .btn-doks-light:hover,
[data-dark-mode] body .btn-doks-light:active {
  color: $link-color-dark;
}

[data-dark-mode] body .btn-menu svg {
  color: $body-color-dark;
}

[data-dark-mode] body .doks-sidebar-toggle {
  color: $navbar-dark-color;
}

[data-dark-mode] body .btn-menu:hover,
[data-dark-mode] body .btn-doks-light:hover,
[data-dark-mode] body .doks-sidebar-toggle:hover {
  background: $body-overlay-dark;
}

/*
[data-dark-mode] body .dropdown-menu {
  @extend .dropdown-menu-dark;
}
*/

[data-dark-mode] body .navbar,
[data-dark-mode] body .doks-subnavbar {
  background-color: rgba(33, 37, 41, 0.95);
  border-bottom: 1px solid $border-dark;
}

[data-dark-mode] body.home .navbar {
  border-bottom: 0;
}

[data-dark-mode] body .offcanvas-header {
  border-bottom: 1px solid $gray-800;
}

[data-dark-mode] body .offcanvas .nav-link {
  color: $body-color-dark;
}

[data-dark-mode] body .offcanvas .nav-link:hover,
[data-dark-mode] body .offcanvas .nav-link:focus {
  color: $link-color-dark;
}

[data-dark-mode] body .offcanvas .nav-link.active {
  color: $link-color-dark;
}

[data-dark-mode] body .navbar-light .navbar-brand {
  color: $navbar-dark-color !important;
}

[data-dark-mode] body .navbar-light .navbar-nav .nav-link {
  color: $navbar-dark-color;
}

[data-dark-mode] body .navbar-light .navbar-nav .nav-link:hover,
[data-dark-mode] body .navbar-light .navbar-nav .nav-link:focus {
  color: $navbar-dark-hover-color;
}

[data-dark-mode] body .navbar-light .navbar-nav .nav-link.disabled {
  color: $navbar-dark-disabled-color;
}

[data-dark-mode] body .navbar-light .navbar-nav .show > .nav-link,
[data-dark-mode] body .navbar-light .navbar-nav .active > .nav-link,
[data-dark-mode] body .navbar-light .navbar-nav .nav-link.show,
[data-dark-mode] body .navbar-light .navbar-nav .nav-link.active {
  color: $navbar-dark-active-color;
}

[data-dark-mode] body .navbar-light .navbar-text {
  color: $navbar-dark-color;
}

[data-dark-mode] body .alert-primary a {
  color: $body-bg-dark;
}

[data-dark-mode] body .alert-doks {
  background: $body-overlay-dark;
  color: $body-color-dark;
}

[data-dark-mode] body .alert-doks a {
  color: $link-color-dark;
}

[data-dark-mode] body .page-links a {
  color: $body-color-dark;
}

[data-dark-mode] body .btn-toggle-nav a {
  color: $body-color-dark;
}

[data-dark-mode] body .showcase-meta a {
  color: $body-color-dark;
}

[data-dark-mode] body .showcase-meta a:hover,
[data-dark-mode] body .showcase-meta a:focus {
  color: $link-color-dark;
}

[data-dark-mode] body .docs-link:hover,
[data-dark-mode] body .docs-link.active,
[data-dark-mode] body .page-links a:hover {
  text-decoration: none;
  color: $link-color-dark;
}

[data-dark-mode] body .btn-toggle {
  color: $body-color-dark;
  background-color: transparent;
  border: 0;
}

[data-dark-mode] body .btn-toggle:hover,
[data-dark-mode] body .btn-toggle:focus {
  color: $body-color-dark;
}

[data-dark-mode] body .btn-toggle::before {
  width: 1.25em;
  line-height: 0;
  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28222, 226, 230, 0.75%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
  transition: transform 0.35s ease;
  transform-origin: 0.5em 50%;
  margin-bottom: 0.125rem;
}

[data-dark-mode] body .btn-toggle[aria-expanded="true"] {
  color: $body-color-dark;
}

[data-dark-mode] body .btn-toggle[aria-expanded="true"]::before {
  transform: rotate(90deg);
}

[data-dark-mode] body .btn-toggle-nav a:hover,
[data-dark-mode] body .btn-toggle-nav a:focus {
  color: $link-color-dark;
}

[data-dark-mode] body .btn-toggle-nav a.active {
  color: $link-color-dark;
}

[data-dark-mode] body .navbar-light .navbar-text a {
  color: $navbar-dark-active-color;
}

[data-dark-mode] body .docs-links h3.sidebar-link a,
[data-dark-mode] body .page-links h3.sidebar-link a {
  color: $body-color-dark;
}

[data-dark-mode] body .navbar-light .navbar-text a:hover,
[data-dark-mode] body .navbar-light .navbar-text a:focus {
  color: $navbar-dark-active-color;
}

[data-dark-mode] body .navbar .btn-link {
  color: $navbar-dark-color;
}

[data-dark-mode] body .content .btn-link {
  color: $link-color-dark;
}

[data-dark-mode] body .content .btn-link:hover {
  color: $link-color-dark;
}

[data-dark-mode] body .content img[src^="https://latex.codecogs.com/svg.latex"] {
  filter: invert(1);
}

[data-dark-mode] body .navbar .btn-link:hover {
  color: $navbar-dark-hover-color;
}

[data-dark-mode] body .navbar .btn-link:active {
  color: $navbar-dark-active-color;
}

[data-dark-mode] body .form-control.is-search {
  background: $body-overlay-dark;
  border: 1px solid transparent;
  color: $gray-300;

  /*
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='feather feather-search'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  */
}

[data-dark-mode] body .form-control.is-search:focus {
  border: 1px solid $link-color-dark;
}

[data-dark-mode] body .doks-search::after {
  color: $gray-300;
  border: 1px solid $gray-700;
}

[data-dark-mode] body .text-dark {
  color: $body-color-dark !important;
}

/*
[data-dark-mode] body .navbar-form::after {
  color: $gray-600;
  border: 1px solid $gray-800;
}
*/

[data-dark-mode] body .form-control {
  color: $gray-300;
}

[data-dark-mode] body .form-control::placeholder {
  color: $gray-400;
  opacity: 1;
}

[data-dark-mode] body .border-top {
  border-top: 1px solid $border-dark !important;
}

@include media-breakpoint-up(lg) {
  [data-dark-mode] body .docs-sidebar {
    order: 0;
    border-right: 1px solid $border-dark;
  }
}

[data-dark-mode] body .docs-navigation {
  border-top: 1px solid $border-dark;
}

[data-dark-mode] body pre code::-webkit-scrollbar-thumb {
  background: $gray-400;
}

[data-dark-mode] body code:not(.hljs) {
  background: $body-overlay-dark;
  color: $body-color-dark;
}

[data-dark-mode] body pre code:hover {
  scrollbar-width: thin;
  scrollbar-color: $border-dark transparent;
}

[data-dark-mode] body pre code::-webkit-scrollbar-thumb:hover {
  background: $gray-500;
}

[data-dark-mode] body blockquote {
  border-left: 3px solid $border-dark;
}

[data-dark-mode] body .footer {
  border-top: 1px solid $border-dark;
}

[data-dark-mode] body .docs-links,
[data-dark-mode] body .docs-toc {
  scrollbar-width: thin;
  scrollbar-color: $body-bg-dark $body-bg-dark;
}

[data-dark-mode] body .docs-links::-webkit-scrollbar,
[data-dark-mode] body .docs-toc::-webkit-scrollbar {
  width: 5px;
}

[data-dark-mode] body .docs-links::-webkit-scrollbar-track,
[data-dark-mode] body .docs-toc::-webkit-scrollbar-track {
  background: $body-bg-dark;
}

[data-dark-mode] body .docs-links::-webkit-scrollbar-thumb,
[data-dark-mode] body .docs-toc::-webkit-scrollbar-thumb {
  background: $body-bg-dark;
}

[data-dark-mode] body .docs-links:hover,
[data-dark-mode] body .docs-toc:hover {
  scrollbar-width: thin;
  scrollbar-color: $border-dark $body-bg-dark;
}

[data-dark-mode] body .docs-links:hover::-webkit-scrollbar-thumb,
[data-dark-mode] body .docs-toc:hover::-webkit-scrollbar-thumb {
  background: $border-dark;
}

[data-dark-mode] body .docs-links::-webkit-scrollbar-thumb:hover,
[data-dark-mode] body .docs-toc::-webkit-scrollbar-thumb:hover {
  background: $border-dark;
}

[data-dark-mode] body .docs-links h3:not(:first-child) {
  border-top: 1px solid $border-dark;
}

[data-dark-mode] body a.docs-link {
  color: $body-color-dark;
}

[data-dark-mode] body .page-links li:not(:first-child) {
  border-top: 1px dashed $border-dark;
}

[data-dark-mode] body .card {
  background: $body-bg-dark;
  border: 1px solid $border-dark;
}

[data-dark-mode] body .card.bg-light {
  background: $body-overlay-dark !important;
}

[data-dark-mode] body .navbar .menu-icon .navicon {
  background: $navbar-dark-color;
}

[data-dark-mode] body .navbar .menu-icon .navicon::before,
[data-dark-mode] body .navbar .menu-icon .navicon::after {
  background: $navbar-dark-color;
}

[data-dark-mode] body .logo-light {
  display: none !important;
}

[data-dark-mode] body .logo-dark {
  display: inline-block !important;
}

[data-dark-mode] body .bg-light {
  background: darken($body-bg-dark, 1.5%) !important;
}

[data-dark-mode] body .bg-dots {
  background-image: radial-gradient($dots-dark 15%, transparent 15%);
}

[data-dark-mode] body .text-muted {
  color: darken($body-color-dark, 7.5%) !important;
}

[data-dark-mode] body .alert-primary {
  background: $link-color-dark;
  color: $body-bg-dark;
}

[data-dark-mode] body .figure-caption {
  color: $body-color-dark;
}

[data-dark-mode] body table {
  @extend .table-dark;
}

[data-dark-mode] body .copy-status::after {
  content: "Copy";
  display: block;
  color: $body-color-dark;
}

[data-dark-mode] body .copy-status:hover::after {
  content: "Copy";
  display: block;
  color: $link-color-dark;
}

[data-dark-mode] body .copy-status:focus::after,
[data-dark-mode] body .copy-status:active::after {
  content: "Copied";
  display: block;
  color: $link-color-dark;
}

/*
[data-dark-mode] body .dropdown-toggle:focus,
[data-dark-mode] body .doks-sidebar-toggle:focus {
  box-shadow: 0 0 0 0.2rem $focus-color-dark;
}
*/

[data-dark-mode] body .offcanvas {
  background-color: $body-bg-dark;
}

[data-dark-mode] body .btn-close {
  background-image: url("");
  background-size: 1.5rem;
}

@include media-breakpoint-up(md) {
  [data-dark-mode] body .alert-dismissible .btn-close {
    background-size: 1.25rem;
  }
}

/*
[data-dark-mode] body .btn-close:focus {
  box-shadow: 0 0 0 0.2rem $focus-color-dark;
}
*/

[data-dark-mode] .dropdown-item {
  color: $body-bg-dark;
}

[data-dark-mode] body hr.text-black-50 {
  color: $gray-600 !important;
}

[data-dark-mode] body .email-form .form-control {
  background: $body-overlay-dark;
  border: 1px solid transparent;
}

[data-dark-mode] body .email-form .form-control:focus {
  border: 1px solid $link-color-dark;
}

[data-dark-mode] .page-link {
  color: $link-color-dark;
  background-color: transparent;
  border: $pagination-border-width solid $border-dark;

  &:hover {
    color: $body-bg-dark;
    background-color: $body-color-dark;
    border-color: $body-color-dark;
  }

  &:focus {
    color: $body-bg-dark;
    background-color: $body-color-dark;
  }
}

[data-dark-mode] .page-item {
  &.active .page-link {
    color: $body-bg-dark;

    @include gradient-bg($link-color-dark);

    border-color: $link-color-dark;
  }

  &.disabled .page-link {
    color: $pagination-disabled-color;
    background-color: $body-overlay-dark;
    border-color: $border-dark;
  }
}

[data-dark-mode] .dropdown-menu {
  background: $body-overlay-dark;
}

[data-dark-mode] .dropdown-menu .dropdown-item {
  color: $body-color-dark;
}

[data-dark-mode] .dropdown-menu .dropdown-item:hover {
  color: $link-color-dark;
  background: $body-bg-dark;
}

[data-dark-mode] .dropdown-menu .dropdown-item.active,
[data-dark-mode] .dropdown-menu .dropdown-item:focus {
  color: $link-color-dark;
  background: $body-bg-dark;
}

[data-dark-mode] .doks-navbar .dropdown-item.current,
[data-dark-mode] .doks-subnavbar .dropdown-item.current {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23dee2e6' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem top 0.6rem;
  background-size: 0.75rem 0.75rem;
}

[data-dark-mode] details {
  border: 1px solid $border-dark;
}

[data-dark-mode] summary:hover {
  background: $body-overlay-dark;
}

[data-dark-mode] details[open] > summary {
  border-bottom: 1px solid $border-dark;
}

[data-dark-mode] details summary::before {
  content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%28222, 226, 230, 0.75%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
}

[data-dark-mode] #toc a.active {
  color: $link-color-dark;
}

[data-dark-mode] .btn-light {
  color: $link-color-dark;
  background: $body-overlay-dark;
  border: 1px solid $body-overlay-dark;
}
